package com.quan.system.common.job;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

import org.quartz.Job;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.quan.common.utils.DateUtils;

import lombok.extern.slf4j.Slf4j;

/**
 * 定时发送邮件作业类
 * 
 * @author Administrator
 *
 */
@Slf4j
public class EmailJob implements Job, Serializable {

	private static final long serialVersionUID = 1L;

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		JobDetail jobDetail = context.getJobDetail();

		// 参数
		Map<String, Object> params = new HashMap<String, Object>();

		// JobDataMap数据
		Set<Entry<String, Object>> entrySet = jobDetail.getJobDataMap().entrySet();
		for (Entry<String, Object> entry : entrySet) {
			params.put(entry.getKey(), entry.getValue());
		}

		log.info("==>【开始执行任务】定时发送邮件：{}, {}, {}", DateUtils.getDateTime(), jobDetail.getKey(), jobDetail.getJobClass());
	}
}
